﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace TaskManage
{
    public partial class FormTaskSubmitBg : Form
    {
        public string uid;

        public FormTaskSubmitBg()
        {
            InitializeComponent();
        }

        private void btnSubmitBg_Click(object sender, EventArgs e)
        {
            string tid = this.textBoxTaskId.Text.ToString();
            string tbg = this.richTextBox1.Text.ToString();

            if (tid == "")
            {
                MessageBox.Show("任务编号不能为空！", "提示");
                return;
            }

            string qstr;
            DBConnect dbConn = new DBConnect();
            int cnt =dbConn.Count("SELECT COUNT(task_id) FROM tasks_info WHERE task_id = '" + tid + "' AND task_revId = '" + uid + "'");
            if (cnt == 0)
            {
                MessageBox.Show("该任务编号不存在或该任务不属于当前用户 [" + uid + "]！", "提示");
                return;
            }

            qstr = "UPDATE tasks_info SET task_revBg = '" + tbg + "' WHERE task_id = '" + tid + "'";
            dbConn.Update(qstr);
            MessageBox.Show("任务报告提交成功", "提示");
        }
    }
}
